pp108 : Returning the Objects of BusObject Class

Returning the Objects of BusObject Class

This topic describes the process by which the objects of the BusObject class are returned in WS-AppServer.


WS-AppServer supports returning objects of theBusObjectclass or theBusObjectIteratorclass, apart from returning the basic data types.

Method Implementation

The following is a sample implementation of a method that returns an object.

<implementation type="BsfJavaCall">
    <class>ITEM</class>
    <method ct="tuples" dt="java:ITEM[]" scope="out">getITEMObjects</method>
    <parameters>
        <fromCODE dt="int"/>
        <toCODE dt="int"/>
    </parameters>
</implementation>


Note: The ct (data type) attribute in this element has been set to tuples, which indicates that the result is returned in the standard WCP tuple format. If you do not specify the attribute, the result returns the data in the format of the WCP JavaCall handler.

Sample Java Code


This example shows the java code used to return an object.

public static BusObjectEnumeration getITEMObjects(int fromCODE, int toCODE)
{
	String queryText = "select * from ITEM where CODE between :fromCODE and :toCODE";
	QueryObject query = new QueryObject(queryText);
	query.addParameter("fromCODE", "ITEM.CODE", QueryObject.PARAM_INT, new Integer(fromCODE));
	query.addParameter("toCODE", "ITEM.CODE", QueryObject.PARAM_INT, new Integer(toCODE));
	query.setResultClass(ITEM.class);
	return query.getObjects();
}

Sample SOAP Request

This example shows the SOAP request used to return an object.

<SOAP:Envelopexmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
 <SOAP:Body>
  <getITEMObjects xmlns="http://BSFDeployement">
   <fromCODE>1</fromCODE>
   <toCODE>100</toCODE>     
  </getITEMObjects>
 </SOAP:Body>
</SOAP:Envelope>

Related concepts

BusObjects

Related reference

Mapping of BusObjects in WS-AppServer
Structure of a BusObject
States of a BusObject
Passing the Parameters of BusObject Class
Retrieving Information about a Class